package DesignPattern.Behavior.Memento.BlackBox;

import Utils.Util;

public class Client {
    public static void main(String[] args) {
        Util.inner(System.out::println,"大战boss前");

        GameRole gameRole = new GameRole();
        gameRole.initState();
        gameRole.stateDisplay();
        RoleStateCaretaker caretaker = new RoleStateCaretaker();
        caretaker.setRoleStateMemento(gameRole.saveState());

        Util.inner(System.out::println,"大战boss后");

        gameRole.fight();
        gameRole.stateDisplay();

        Util.inner(System.out::println,"恢复之前的状态");

        gameRole.recoverState(caretaker.getRoleStateMemento());
        gameRole.stateDisplay();
    }
}
